import request from '@/utils/request'
// 统一请求体
const creatRequestView = () => {
  return {
    reqInMsgHeader: {
      ReqModles: 'xxx'// 请求模式-备用
    },
    main: {}
  }
}

const defaultRequestView = creatRequestView()// 获得初始化的请求体对象
const updateDefaultRequestView = { // 创建更新默认请求实体对象方法
  update: (obj) => {
    Object.assign(defaultRequestView.main, obj) // 用法：assign(target,obj)
  },
  updateRequestHeader: (obj) => {
    Object.assign(defaultRequestView.reqInMsgHeader, obj) // 用法：assign(target,obj)
  }
}
// 分页查询
export function getAllPayInfoPage(queryparams) {
  updateDefaultRequestView.update(queryparams)
  return request({
    url: '/payinfo/getAllPayInfoPageFilter',
    method: 'post',
    data: defaultRequestView
  })
}
// 查询所有
export function getAllQuarterPayInfoByHouseCode(householdCode) {
  updateDefaultRequestView.update({ zhbh: householdCode })
  return request({
    url: '/payinfo/getAllQuarterPayInfoByHouseCode',
    method: 'post',
    data: defaultRequestView
  })
}
// 查询所有
export function getAllHasPaidPayInfoByHouseCode(householdCode) {
  updateDefaultRequestView.update({ zhbh: householdCode })
  return request({
    url: '/payinfo/getAllHasPaidPayInfoByHouseCode',
    method: 'post',
    data: defaultRequestView
  })
}
// 增加
export function addOneOrBatchPayInfo(idArray, householdCode) {
  updateDefaultRequestView.update({
    expanseIdList: idArray, zhbh: householdCode
  })
  return request({
    url: '/payinfo/addBatchPayInfo',
    method: 'post',
    data: defaultRequestView
  })
}
// 修改
export function modifyOneOrBatchPayInfo(payInfosArray, isCheck) {
  updateDefaultRequestView.update({ payInfos: payInfosArray, sfdz: isCheck })
  return request({
    url: '/payinfo/modifyBatchPayInfo',
    method: 'post',
    data: defaultRequestView
  })
}
// 缴费接口
export function processingPay(payInfosArray) {
  updateDefaultRequestView.update({ payInfos: payInfosArray })
  return request({
    url: '/payinfo/processingPay',
    method: 'post',
    data: defaultRequestView
  })
}
// 删除
export function dropOneOrBatchPayInfo(array) {
  updateDefaultRequestView.update({ PayInfoIdList: array })
  return request({
    url: '/payinfo/dropBatchPayInfo',
    method: 'post',
    data: defaultRequestView
  })
}
